package com.hdax.dm.controller;

import com.hdax.dm.dto.CommonResponse;
import com.hdax.dm.dto.scheduler.SchedulerPriceDto;
import com.hdax.dm.dto.scheduler.TimePlanDto;
import com.hdax.dm.service.DmSchedulerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(path = "/scheduler")
public class DmSchedulerController {
    @Autowired
    private DmSchedulerService dmSchedulerService;

    //获取到商品的排期信息
    @PostMapping(path = "/getTimePlan")
    public CommonResponse<List<TimePlanDto>> getTimePlan(@RequestBody Map<String,Long> params){
        return dmSchedulerService.getTimePlan(params.get("itemId"));
    }

    //获取到排期的价格信息
    @PostMapping(path = "/getPrice")
    public CommonResponse<List<SchedulerPriceDto>> getPrice(@RequestBody Map<String,Long> params){
        return dmSchedulerService.getPrice(params.get("scheduleId"));
    }
}
